package namedemo1;

import com.alibaba.nacos.api.exception.NacosException;
import com.alibaba.nacos.api.naming.NamingFactory;
import com.alibaba.nacos.api.naming.NamingService;
import com.alibaba.nacos.api.naming.pojo.Instance;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

public class registry2 {
    public static void main(String[] args) throws NacosException, IOException {

        NamingService namingService = NamingFactory.createNamingService("localhost:8848");

        Instance instance = new Instance();
        instance.setHealthy(true);
        instance.setIp("1.1.1.2");
        instance.setWeight(2.0);
        Map<String,String> meta = new HashMap<>();
        meta.put("name","utt");
        instance.setMetadata(meta);;

        namingService.registerInstance("app1",instance);
        System.in.read();
    }
}
